package com.example.android.simpleservice; // Noting the path

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class CalServiceTest extends Activity {
	// Called when the activity is first created 
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		int a = Native.add(1, 1);
		TextView tv = new TextView(this);
		tv.setText("1 + 1 = " + Native.add(1, 1)); // display
		tv.append("\n3 - 1 = " + Native.sub(3, 1));
		tv.append("\n2 * 3 = " + Native.mul(2, 3));
		tv.append("\n4 / 2 = " + Native.div(4, 2));
		setContentView(tv);
	}
}

class Native {
	static native int add(int a, int b);
	static native int sub(int a, int b);
	static native int mul(int a, int b);
	static native float div(int a, int b);
	static 
	{
		// Get the dynamic library through load method.
		// omit the prefix lib.
		System.loadLibrary("JniCal");
	}
}

